<template>
  <div class="Ls-Reset-head-wrapper">
    <div class="title-wrap">
      <div class="left">
        <i v-if="leftIcon === 'none'"></i>
        <img src="./assets/icon_back.png" v-else alt="" @click="handleBack">
      </div>
      
      <span :class="ownclass === 'black' ? 'black' : ''">{{title}}</span>
      <div class="right">
        <i v-if="rightIcon === 'none'"></i>
        <img src="./assets/icon_black_close.png" v-else-if="rightIcon === 'icon_black_close'" alt="" @click="handleClose">
        <i v-else ></i>
      </div>
    </div>
  </div>
</template>

<script>
import {appHideOrShowHead} from '@@plugins/appAgreement.js'

export default {
  props: ['title', 'leftIcon', 'rightIcon', 'ownclass'],
  data() {
    return {}
  },
  mounted() {
    appHideOrShowHead()
  },
  methods: {
    handleBack() {
      this.$emit('back', true)
    },
    handleClose() {
      this.$emit('closepage', true)
      
    }
  },
  destroyed() {
    appHideOrShowHead(false) // 销毁前 显示头部
  }
}
</script>

<style lang="scss" scoped>
.Ls-Reset-head-wrapper {
  padding-top: $safeTop;
  .title-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 30px 0;
    font-size: 0;
    .left {
      display: inline-block;
      min-width: 40px;
      img {
        width: 40px;
        height: 40px;
      }
    }
    .right {
      display: inline-block;
      min-width: 40px;
      img {
        width: 40px;
        height: 40px;
      }
    } 
    span {
      display: inline-block;
      height: 40px;
      line-height: 43px;
      font-size: 34px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: center;
      color: #ffffff;
      &.black {
        color: #1d1d1d;
      }
    }
    i {
      width: 40px;
      height: 40px;
    }
  }
}
</style>
